package com.md24housecall.fragment;

import android.annotation.SuppressLint;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;

import com.md24housecall.activity.R;
import com.md24housecall.fibromyalgiadiagnostic.IntroductionFragment;
import com.md24housecall.util.GlobalConstant;
import com.md24housecall.util.MyLog;

public final class FibroDiagnosticFragment extends HomeFragment  {
	private static final String KEY_TAB_POSITION = "TestFragment:Position";
	private int mTabPosition = 0;

	public static FibroDiagnosticFragment newInstance(int tabPosition) {
		FibroDiagnosticFragment fragment = new FibroDiagnosticFragment();

		Bundle args = new Bundle();
		args.putInt(KEY_TAB_POSITION, tabPosition);
		fragment.setArguments(args);

		return fragment;
	}


	@Override
	public void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);

		if (getArguments() != null) {
			mTabPosition = getArguments().getInt(KEY_TAB_POSITION, 0);
		}
	}

	@SuppressLint("SetJavaScriptEnabled")
	private void initialize() {
		IntroductionFragment firstFragment = new IntroductionFragment();

        // In case this activity was started with special instructions from an Intent,
        // pass the Intent's extras to the fragment as arguments
        firstFragment.setArguments(getActivity().getIntent().getExtras());

        // Add the fragment to the 'fragment_container' FrameLayout
        getActivity().getSupportFragmentManager().beginTransaction()
                .add(R.id.fragment_container, firstFragment).commit();
	}

	@Override
	protected View initView(LayoutInflater inflater,ViewGroup container) {
		// TODO Auto-generated method stub
		return inflater.inflate(R.layout.fibro_diagnostic, container, false);
	}
	
	@Override
	protected void initLayout() {
		// TODO Auto-generated method stub
		try{
			initialize();
		}catch (Exception e) {
			// TODO: handle exception
//			e.printStackTrace();
			MyLog.d(GlobalConstant.TAG, "exception onCreateView HelpFragment: "+e.getMessage());
		}
	}
	@Override
	public View onCreateView(LayoutInflater inflater, ViewGroup container,
			Bundle savedInstanceState) {
		return super.onCreateView(inflater, container, savedInstanceState);
	}

	@Override
	public void onActivityCreated(Bundle savedInstanceState) {
		super.onActivityCreated(savedInstanceState);
	}

	@Override
	public void onSaveInstanceState(Bundle outState) {
		super.onSaveInstanceState(outState);
		outState.putInt(KEY_TAB_POSITION, mTabPosition);
	}
}
